
# pip install sympy
from sympy import *

x, y, z = symbols("x y z")

# 求解单个方程
print(solve(x**2 - 2*x, x))
print(solve(x**2 + 2*x + 1, x))

# 求解线性方程组
print(linsolve([
	x + y - 8,
	x - y - 2,
], [x, y]))

# 求解非线性方程组
print(nonlinsolve([
	x - y - 1,
	x ** 2 - y**2 - 7,
], [x, y]))